<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>添加模型页面</title>
<css file='__PUBLIC__/css/base.css' />
<jquery />
<js file='__PUBLIC__/js/iframe.js' />
<script src="__DATA__/validate.min.js" language="javascript"></script>

    </head>
    <body style="padding:10px;">
        <div class="now_path">
            <strong>您现在的位置：</strong>
            <a href="__CONTROL__/index">模型管理</a> > 添加模型
        </div>
		<fieldset class='field_tishi'>
			<legend>操作提示</legend>
			增加模型时，请注意相对应的选项填好！当模型为系统模型的时候时候不能直接删除，必须修改成为非系统模型才能删除（模型下没有栏目）
		</fieldset>
		<div class="success_box">所有的选项都填写正确</div>
    	<div class="error_box"></div>
        <form action="__CONTROL__/add_exe" method="post" name='model'>
                <div id="tabs-0">   
                    <table class="table2">
                        <tr>
                            <th>模型名称：</th>
                            <td><input type="text" name="title" style="width:360px;"/>
                                <span class="desc">模型中文描述</span></td>
                        </tr>
                        <tr>
                            <th>主表名称：</th>
                            <td><input type="text" name="mname" style="width:200px;"/>
                                <span class="desc">主表名称必须为英文</span>
							</td>
                        </tr>
                        <tr>
                            <th>排序：</th>
                            <td><input type="text" name="sort" style="width:260px;" value="0"/></td>
                        </tr>
                        <tr>
                            <th>是否为系统模型：</th>
                            <td>
                                <input type="radio" name="issystem" value="1" />是&nbsp;&nbsp;
                                <input type="radio" name="issystem" value="0" checked="checked"/>否 
                            </td>
                        </tr>
                        <tr>
                            <th>创建建数据表方式：</th>
                            <td><input type="radio" name="createtable" value="1" checked="checked"/>主副表（推荐）&nbsp;&nbsp;
                                <input type="radio" name="createtable" value="2"/>独立表</td>
                        </tr>
                            <tr>
                                <th>状态：</th>
                                <td><input type="radio" name="state" value="1" checked="checked"/>开启&nbsp;&nbsp;
                                    <input type="radio" name="state" value="0"/>关闭</td>
                            </tr>
                            <tr>
                                <th>封面模板：</th>
                                <td><input type="text" name="indextpl" id="indextpl" value="news_index.html" style="width:300px;"/></td>
                            </tr>
                            <tr>
                                <th>列表页模板：</th>
                                <td><input type="text" name="listtpl" id="listtpl" value="news_list.html" style="width:300px;"/></td>
                            </tr>
                            <tr>
                                <th>内容页模板：</th>
                                <td><input type="text" name="arctpl" id="arctpl" value="news_arc.html" style="width:300px;"/></td>
                            </tr>
							<tr>
                                <th>模型描述：</th>
                                <td><textarea style="height:60px;width:90%" name='description'></textarea></td>
                            </tr>
                    </table>
                </div>

                <div style="padding-left:100px;">
                    <input type="submit" value="添加模型" class="submit" name="submit"/>
                </div>
        </form>
	<script type='text/javascript'>
		var SELECTOR_ERRORS = document.getElementById('error_box');
		var validator = new FormValidator('model', [{
		    name: 'title',
		    display: '模型名称',    
		    rules: 'required'
		},{
    		name: 'mname',
			display: '主表名称',
    		rules: 'required|min_length[3]'
		}
		], function(errors, event) {
		    var SELECTOR_ERRORS = $('.error_box'),
		        SELECTOR_SUCCESS = $('.success_box');
		        
			    if (errors.length > 0) {
			        SELECTOR_ERRORS.empty();
			        
			        for (var i = 0, errorLength = errors.length; i < errorLength; i++) {
			            SELECTOR_ERRORS.append(errors[i].message + '<br />');
			        }
			        
			        SELECTOR_SUCCESS.css({ display: 'none' });
			        SELECTOR_ERRORS.fadeIn(200);
					return false;
			    } else {
			        SELECTOR_ERRORS.css({ display: 'none' });
			        SELECTOR_SUCCESS.fadeIn(200);
					return true;
			    }
		});
	</script>
    </body>
</html>
